let ajax = (url, callback, failCallback) => {
    var xmlhttp = new XMLHttpRequest()
    xmlhttp.open('get', url, true)
    xmlhttp.send()
    //核心：服务器响应数据
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
            let obj = JSON.parse(xmlhttp.responseText)
            callback(obj)
        }
        else if (xmlhttp.readyState === 4 && xmlhttp.status === 404) {
            failCallback('文件路径不存在')
        }
    }
}
export { ajax }